There are two ways that you can access run ends data:
-
IG_runs_row_get()/IG_runs_row_set() allow you to read and write rows of run ends data.
- IG_runs_row_get() retrieves a pointer to the run ends data.
- IG_runs_row_set() updates a row with compressed data from a buffer you supply.
These functions are the recommended way of accessing run ends data. The format of the data is exactly as described in the previous section.
-
IG_image_DIB_raster_pntr_get() is a general purpose function for getting a pointer to pixel data for a given raster. If you use it on a 1bpp image, it will return a pointer to a run ends raster. You can access this raster directly, but be aware of the following:
- There is an additional AT_RUN value at the beginning of the raster. This value is equal to the total number of AT_RUN values used to store the raster, including this value. For example, for the raster "11001000", this value would be 7.
- You cannot write data that exceeds the original length of a raster, because ImageGear allocates only enough space to hold the runs for that raster. For this reason, it is safer to use IG_runs_row_set(), which can reallocate if necessary.
- Run ends rasters are not stored contiguously in memory. You must call IG_image_DIB_raster_pntr_get() for each raster you want to process.